/*interface A {
    name: string
}
interface B extends A {
    age: number,
}
let a: B = {
    name: '张三',
    age: 18
}*/



// 交叉类型 &
/*interface A {
    name: string
}
interface B {
    age: number,
}
let b: A & B = {
    name: '李四',
    age: 10
}*/



interface A {
    name: string
}
interface B {
    age: number,
}
type C = A & B
let b: C = {
    name: '李四',
    age: 10
}



// & 和 extends 的区别     extends 不会处理类型冲突
/*
interface A {
    name: string
}
interface B {
    age: number,
    name:boolean
}
type C = A & B    //到这一步还不会报错
// let b: C = {   //实例后会报错
//     name: '李四',
//     age: 10
// }*/



/*
interface A {
    name: string
}
interface B extends A {
    age: number,
    name:boolean   //在这就会报错
}
// let a: B = {
//     name: '张三',
//     age: 18
// }*/
